package org.pps.gl.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import org.pps.gl.client.vue.Footer;
import org.pps.gl.client.vue.Header;
import org.pps.gl.client.vue.Corps;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Pps_gl implements EntryPoint {

	private DockLayoutPanel mainPanel = new DockLayoutPanel(Unit.PX);
	private static ConnectionManager cm;

	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {
		cm = new ConnectionManager();

		RootLayoutPanel rootPanel = RootLayoutPanel.get();
		
		VerticalPanel verticalPanel = new VerticalPanel();
		//verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
		verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
		rootPanel.add(verticalPanel);
		verticalPanel.setSize("100%", "100%");
		
		// haut de page définit dans vue
		Header header = new Header();
		verticalPanel.add(mainPanel);
		mainPanel.setHeight("100%");
		mainPanel.addNorth(header, 130.0);
		//header.setSize("450", "130");

		// bas de page définit dans vue
		Footer footer = new Footer();
		mainPanel.addSouth(footer, 50.0);
		
		// milieu de page définit dans vue
		Corps corps = new Corps();
		mainPanel.add(corps);
		corps.setHeight("100%");
		
		corps.setStylePrimaryName("dimensionCorps");
		mainPanel.setStylePrimaryName("dimensionPage");

		cm.addConnectedEventHandler(corps);
		cm.addSignOutHandler(corps);

		cm.addConnectedEventHandler(header);
		cm.addSignOutHandler(header);

		cm.connect();

	}

	/**
	 * @return the cm
	 */
	public static ConnectionManager getCm() {
		return cm;
	}

}
